INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/include" "${Boost_INCLUDE_DIR}")

IF(APPLE OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
    SET(CMAKE_CXX_FLAGS "-std=c++11 -march=native -Wall -pedantic -Wextra -Weffc++ -Werror -O3 ${CMAKE_CXX_FLAGS}")
ENDIF()

IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
    SET(CMAKE_CXX_FLAGS "-std=c++11 -march=native -Wall -pedantic -Wextra -Weffc++ -Werror -O3 -finline-functions -finline-limit=64 ${CMAKE_CXX_FLAGS}")
ENDIF()

#
# RECURSIVE ADD TESTS
#
FILE (GLOB_RECURSE tests_SRCs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
FOREACH (SRC_FILE ${tests_SRCs})
	GET_FILENAME_COMPONENT (FILE_NAME ${SRC_FILE} NAME_WE)
	
	ADD_EXECUTABLE (${FILE_NAME} ${SRC_FILE})

	IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
		TARGET_LINK_LIBRARIES(${FILE_NAME}
		jsonpack-static
		${Boost_FILESYSTEM_LIBRARY}
		${Boost_SYSTEM_LIBRARY}
		${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
	)
	ELSE()
		TARGET_LINK_LIBRARIES(${FILE_NAME}
		jsonpack
		${Boost_FILESYSTEM_LIBRARY}
		${Boost_SYSTEM_LIBRARY}
		${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
	)
	ENDIF()
ENDFOREACH (SRC_FILE ${tests_SRCs})


ADD_TEST(NAME test-pack-unpack-int
    COMMAND test_jsonpack_int)
